﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace Chinesys.UI.Helpers
{
    public static class UIHelper
    {
        public static void SelectComboValue(string value, DropDownList combo)
        {
            foreach (ListItem item in combo.Items)
            {
                if (item.Value == value)
                {
                    item.Selected = true;
                }
                else
                {
                    item.Selected = false;
                }
            }
        }

        public static void SelectComboDescription(string description, DropDownList combo)
        {
            foreach (ListItem item in combo.Items)
            {
                if (item.Text == description)
                {
                    item.Selected = true;
                }
                else
                {
                    item.Selected = false;
                }
            }
        }
    }
}